stage.set_background("schoolentrance")
stage.wait(2)
stage.create_grid_overlay(50, "blue")
stage.set_background_color("azure")
emma = codesters.Sprite("person1")
emma.set_size(0.5)
michael = codesters.Sprite("person2")
michael.set_size(0.5)
emma_x = random.randint(-230,230)
emma_y = random.randint(-230,230)
emma.go_to(emma_x, emma_y)
michael_x = random.randint(-230,230)
michael_y = random.randint(-230,230)
michael.go_to(michael_x, michael_y)
t = codesters.Teacher()
deltax = t.find_text("delta_x")
try:
tval1 = deltax[0][1].replace(" ", "")
except:
tval1 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == "delta_x=emma_x-michael_x" , "Great Job!")
t1.add_failure(tval1 == "DNE", "Did you drag out a Delta X tool?")
t1.add_failure(tval1 == "delta_x=michael_x-emma_x", "Whoops! You reversed netx and ballx!")
t1.add_failure("-" not in tval1, "Did you drag out the Delta X tool?")
t1.add_failure("emma_x" not in tval1, "Did you change x2 to emma_x?")
t1.add_failure("michael_x" not in tval1, "Did you change the x1 to michael_x")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)